<template>
  <div class="bg-white">
    <div class="pb-5 setgray">
      <div class="w">
        <comp-works-title class="text-white">
          <template v-slot:title>
            <h2 style="font-weight: normal">最新推荐作者</h2>
          </template>
          <template v-slot:btn
            ><router-link to="/" class="btn bg-white">全部</router-link>
          </template>
        </comp-works-title>
        <div class="row">
          <div
            class="col-12 col-lg-3"
            style="padding: 0 12px"
            v-for="item in recommendModule.author_recommend"
            :key="item.aid"
          >
            <comp-artist-list :item="item"></comp-artist-list>
          </div>
        </div>
      </div>
    </div>
    <div class="mt-3">
      <div class="w">
        <div class="d-flex justify-content-between align-items-center">
          <ul class="wb_navs d-flex flex-row wb_nav" style="flex: 1">
            <li
              :class="index == 1 ? 'active_nav' : ''"
              @click="changeNav(1, 'CompAuthorUpdate')"
            >
              推荐作者更新
            </li>
            <li
              href="#"
              :class="index == 2 ? 'active_nav' : ''"
              @click="changeNav(2, 'CompUserUpdate')"
            >
              活跃用户更新
            </li>
          </ul>
          <div class="col-4 d-none d-lg-block">
            <input
              type="text"
              class="w-100 search_inp border rounded"
              placeholder="搜索用户"
            />
          </div>
        </div>
      </div>
    </div>
    <div class="bg-white py-5">
      <div class="w">
        <component :is="comp"></component>
      </div>
    </div>

    <div
      class="
        w
        d-flex
        align-items-center
        justify-content-center
        pt-3
        pb-3
        mt-4
        mb-4
      "
    >
      <el-pagination background layout="prev, pager, next" :total="500">
      </el-pagination>
    </div>
  </div>
</template>

<script>
import CompArtistList from "../components/comp-artist-list.vue";
import CompAuthorUpdate from "../components/comp-author-update.vue";
import CompUserUpdate from "../components/comp-user-update.vue";

import CompWorksTitle from "../components/comp-worksTitle.vue";

import { mapState } from "vuex";
export default {
  components: {
    CompWorksTitle,
    CompArtistList,
    CompAuthorUpdate,
    CompUserUpdate,
  },
  data() {
    return {
      comp: "CompAuthorUpdate",
      index: 1,
    };
  },
  computed: {
    ...mapState(["recommendModule"]),
  },
  methods: {
    changeNav(i, name) {
      this.index = i;
      this.comp = name;
    },
  },
};
</script>

<style lang="less" scoped>
@import "../assets/reset";
.setgray {
  background-image: url(https://photo7n.gracg.com/173f6e0a32ffed99fd15b5d3ee1900b2.jpg!org);
  background-size: cover;
  background-position: top center;
}
.wb_nav {
  height: 50px;
  li {
    font-size: 14px;
    color: #888;
    padding: 15px 0;
    margin: 0 15px;
    cursor: pointer;
  }
  .active_nav {
    color: #000;
    font-weight: bold;
    border-bottom: 2px solid #f9dd4e;
  }
}
.search_inp {
  // background-color: #f00;
  height: 40px;
  padding-left: 30px;

  font-size: 14px;
  background-image: url(http://www.gracg.com/_templates/css/search.png);
  background-size: 20px;
  background-repeat: no-repeat;
  background-position: 5px center;
}
</style>